﻿<%@ WebHandler Language="C#" Class="ChonmuaHandler" %>

using System;
using System.Web;
using System.Collections.Generic;
using System.Web.SessionState;


public class ChonmuaHandler : IHttpHandler, IRequiresSessionState 
{
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";
        
        int IDcode = Convert.ToInt16(context.Request["idTD"]);
        GioHang.MuaSp(IDcode, 1);
        
        ////tính tổng số lượng, tiền để trả về client --> in ra
        double tong = GioHang.TongTrigia();
        int sl = ((List<MuaSanPham>)context.Session["GioHang"]).Count;
        
        context.Response.Write(tong);
        //context.Response.Write(sl.ToString());
    }
    public bool IsReusable {
        get {
            return false;
        }
    }
}